Currently, the barcode technology is part of various sectors of the commercial, industrial and financial area. We can find barcodes to identify the products of a supermarket, books of a library, in the machinery of an industry, in bank bills, in the equipment of an organization, employee's badges in a company, etc.
In general, the barcodes representing the original information through the widths and spaces of parallel bars arranged horizontally. This type of barcode has only one dimension and is known as one-dimensional barcode or linear. As an example of linear barcode has the EAN-13, the code 128, the code 39, among others.
Recently, there have been barcodes capable of storing information vertically and horizontally and are called 2D or two-dimensional barcode. They can store a large amount of information. As an example we can cite the QR Code, DataMatrix, PDF417, the Code 49, among others.
Some barcodes have their structure standardized by international organizations, such as the EAN-13. Other codes are free, where those who want to use it can freely position the data as desired, for example, the code 128. With this, many organizations have defined their own structures.
The standard barcode EAN-13 is often used to identify products sold in shops. This standard barcode consists of a unique identification of products that is used by manufacturers, wholesalers, retailers, distributors and consumers in nearly all the world.
To read the barcode, it uses an optical scanning equipment known as a scanner or barcode reader. This equipment performs the scanning of the barcode by sending a beam of red light that is absorbed by the dark bars and reflected by the white bars. Sensors present in the scanner captures this information and send it to a computer that performs data translation for numbers or letters.
With the advancement of technology, it became possible to create lighter barcode readers based on optical reading and that occupy less space, making them more portable. Despite this, these readers are designed only for reading barcodes, and, in general, can only make the reading of the standard barcode for which they were developed.
The U.S. patent US2006020039, entitled: Camera-based Barcode Recognition, published on Sep. 14, 2006, proposes a system for decoding barcodes from images captured by digital cameras. This system performs the decoding of barcodes from images obtained in preview mode, but does not present a technique to prevent degradation of the images displayed on the display of the device in question. To find the limits of the barcode, the patent US2006020039 uses a method that has as its principle finding the white areas located on the left and right side of the barcode from the center of the same. This method is inefficient because these white areas can be found damaged, making this method inaccurate. After correcting the rotation, the image returned will be a sub-region located in the center of the barcode, excluding the rest of the code. This procedure is not efficient, because the image may be returned in worse condition than in the excluded regions. The binarization used by said patent has fixed parameters, i.e., they are not adaptive, thus, this process becomes ineffective, reducing the probability of success of the decoder.
The patent US20050011957, entitled System and Method for Analyzing and Decoding Barcodes Using a Mobile Device, published on Jan. 20, 2005, presents an application for decoding barcodes. This application consists of a system and method that improves the image and get the information encoded by the barcode contained in the image. Then, through a wireless connection, it sends the result of decoding to a server that is responsible for processing the barcode information and transmit back the content associated with the mobile device. That patent describes, without giving details, the complete flow of a process for image correction and decoding of the barcode. This process takes several attempts to decode using different parameters, which are obtained through a pre-established set of parameters, which aims to improve the image and thereby increasing the probability of decoding the barcode successfully. These operations are performed on images captured in the “preview” mode of the camera integrated into the mobile device. That patent mentions methods for: rotation correction, perspective correction, removal of shear, correction of problems related to lighting, focus adjustment, among other for removing the distortions that can affect the image of the barcode. The patent US20050011957 does not describe the operation of an important requirement for successful decoding, the calculation of the cutting level between white and black.
The patent document PI 0603273-7, published on Jan. 25, 2008, describes a system and method that uses software to perform the decoding of barcodes on mobile devices. That patent describes a method of pre-processing the image captured by the camera of the device to verify the presence of a barcode. This method consists of converting the image into two colors, and then performing a scanning process of the image that aims to convert the same into two color states. After this procedure, the elements contained in the image are filtered. Next, a parameterization is performed to identify the component parts of the image. Then, the component parts are checked to locate or not a barcode. If the scan result is positive, the value represented in the barcode is obtained. The steps taken by the process described in document PI 0603273-7 Brazil are not presented in sufficient details. The document PI0603273-7 shows the current state of the art, and does not adds new elements or explain how to solve the problems, while showing them.
The document entitled “Digital Processing of Barcode Image using Mobile Phones” by James Tudisco Henrique dos Santos and Almir Olivette Artero, published on Jul. 7, 2010 at the Sixth Workshop on Computer Vision, proposes the use of mobile phones equipped with cameras to read and interpret barcode EAN-13, using J2ME technology. This document uses the Sobel operator for edge detection to locate and make reading the barcode. The method presented in this article creates a map of directions from the edges of the gradients obtained by running the Sobel operator, eliminating the edges with low magnitude. The said system does not include solutions for problems related to lighting, so in order to have the decoding done successfully, it is necessary that the barcode is in ideal conditions, with no anomalies caused by a lack of focus, shadows and noise.
The document entitled “Locating and Decoding EAN-13 Barcodes from Images Captured by Digital Cameras” by Douglas Chai and Florian Hock, dated Dec. 6, 2005, presents a technique based on computer vision to locate and decode barcode. To locate the barcode, the image is divided into blocks of 32×32 pixels, and then applies the method of Otsu-thresholding for thresholding in each of these blocks. Then, it is carried out a morphological operation called “skeletonizing” in each block. To determine whether the block has a barcode or not, they separate the connected components of each block, and then calculates the angle of these components relative to the axis x. Only those blocks whose angles of the components are similar, indicating that they are parallel, are kept in the picture. Although the technique seems to be effective, it requires a high computational cost, since the method presented in this article performs morphological operations that require high computational costs. The paper presents a simple method of decoding, which runs without any previous treatment in the image to remove distortions caused by the lighting of the environment, treatment of signal/noise, perspective removal.
The papers cited above have various processes for decoding barcode, where each has different methods to try to recognize the barcode in the best possible way. Images captured in uncontrolled environments suffer interference that impedes their analysis. These interferences can be: problems related to lighting, presence of image noise, low contrast, image captured in motion, blur, perspective and rotation distortion, among other problems. Most solutions described by the mentioned papers will perform reading the barcode successfully, only if the image is captured under ideal conditions, that is, if there is no influence of the problems previously reported. Many studies have cited the need to implement methods to improve image quality, and therefore increasing the probability of successful decoding, however, they do not describe in details how of these methods works.
The patent document U.S. US20040099741, published on May 27, 2004, disclosures a system and method for obtaining information about the selected image from a digital image and provides information about the image selected for handling. In one aspect, the present invention locates and automatically segment an item from an image captured by a digital camera and provides an image information on the item for processing. Alternatively, a user can designate which areas of an image include the item of interest for viewing or further processing, the slope being located based on the Hough transform.
The patent document U.S. US20060202039, published on Sep. 14, 2006, presents a system for decoding information concerning barcodes from an image captured by the camera, by generating a binary sequence of the captured image and decoding information coming from the barcode sequence binarized. The image captured by the camera is pre-processed in a grayscale image, and enhancing the contrast between the bars and spaces of the pre-processed image. The orientation of the barcode is identified so that it is parallel to the bars in the pre-processed image. A designed sequence is formed by projecting pixels of the preprocessed image along the orientation of the barcode. The binarized sequence is formed by applying a threshold to detect peaks of the designed sequence. A sequence of barcode is formed, starting from the binarized sequence, in which each bar and each barcode space are represented by a single bit in their coding sequence of the barcode. Then, information is extracted from the sequence of the encoded barcode. According to the teachings of that document, the tilt angle is found by projecting the binarized image of the barcode on the axes x and y.
Differently from the papers mentioned above, the present invention aims a method for reading the barcode from an image captured by a camera of a portable device, taking into account the presence of abnormalities that affect image quality. For this, the present invention provides a method to eliminate distortions related to perspective and the rotation of the barcode, lighting, low contrast, to improve the signal /noise rate, among others.